import { ApiCall } from "tsrpc";
import { ReqRename, ResRename } from "../../../shared/master/body/PtlRename";
import { player } from "../../../model/fight/body/player";
import { template } from "../../../shared/master/MsgAction";

export default async function (call: ApiCall<ReqRename, ResRename>) {
    call.succ({})
    let user = call.req._player as player;
    let log = user.check_wallet(0, 0, [{ id: 'prop-6', v: 1 }], false, '角色改名消耗', true);
    if(!log.state){
        return;
    }
    // 修改角色名称
    user.name = call.req.name;
    user.sendMsg(template.default,`角色改名成功，新名称为：${call.req.name}`);
}